//
//  MineViewController.m
//  TenThousand
//
//  Created by 我的 on 16/6/20.
//  Copyright © 2016年 baixue. All rights reserved.
//

#import "MineViewController.h"

#import "PlatformIntroductionViewController.h"//平台介绍Controller
#import "TeamManagerViewController.h"//管理团队Controller
#import "DevelopmentHistoryViewController.h"//发展历程Controller
#import "LawsAndRegulationsViewController.h"//法律法规Controller
#import "ContactUsViewController.h"//联系我们Controller


#import "AnswerLoginRegisterViewController.h"//注册登录Controller

@interface MineViewController ()<UITableViewDelegate,UITableViewDataSource>

@end
#define textLable @[@"平台介绍",@"管理团队",@"发展历程",@"法律法规",@"联系我们"]
#define StextLable @[@"注册登录",@"充值提现",@"投资回款",@"账户安全",@"名词解释"]
@implementation MineViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1.00];
    [self createLeft:[UIImage imageNamed:@"ZHSZicon_03"] leftClick:^{
        [self.navigationController popViewControllerAnimated:YES];
    } right:nil rightClick:nil];
    [self myTableView];
    
    if (_num == 0) {
        self.navigationItem.title = @"关于我们";
    }else self.navigationItem.title = @"帮助中心";
}

//创建tableView
- (UITableView *)myTableView{
    _myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, Screen_Width, Screen_Height-49) style:UITableViewStylePlain];
    _myTableView.delegate = self;
    _myTableView.dataSource = self;
    _myTableView.backgroundColor = [UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1.00];
    _myTableView.separatorStyle = NO;
    _myTableView.showsVerticalScrollIndicator = NO;
    [self.view addSubview:_myTableView];
    
    return _myTableView;
}

//返回5组
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 5;
}

//每组1行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

//每行40高度
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}

//cell复用
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CELLID"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CELLID"];
    }
    
    if (_num == 0) {
        cell.textLabel.text = textLable[indexPath.section];
    }else if(_num == 2){
        cell.textLabel.text = StextLable[indexPath.section];
    }
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.textColor = [UIColor colorWithRed:0.56 green:0.56 blue:0.58 alpha:1.00];
    cell.textLabel.font = [UIFont systemFontOfSize:17.0f];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.backgroundColor = [UIColor whiteColor];
    return cell;
    
}

//每组的头部高度为10
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 10;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    UIBarButtonItem *back = [[UIBarButtonItem alloc] init];
    back.title = @"";
    self.navigationItem.backBarButtonItem = back;
    
    if (_num == 0) {
        if (indexPath.section == 0) {
            PlatformIntroductionViewController *platform = [[PlatformIntroductionViewController alloc] init];
            platform.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:platform animated:YES];
        }else if (indexPath.section == 1){
            TeamManagerViewController *team = [[TeamManagerViewController alloc] init];
            team.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:team animated:YES];
        }else if (indexPath.section == 2){
            DevelopmentHistoryViewController *develop = [[DevelopmentHistoryViewController alloc] init];
            develop.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:develop animated:YES];
        }else if (indexPath.section == 3){
            LawsAndRegulationsViewController *laws = [[LawsAndRegulationsViewController alloc] init];
            laws.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:laws animated:YES];
        }else{
            ContactUsViewController *contact = [[ContactUsViewController alloc] init];
            contact.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:contact animated:YES];
        }

    }else if(_num == 2){
        AnswerLoginRegisterViewController *login = [[AnswerLoginRegisterViewController alloc] init];
        login.index = indexPath.section;
        login.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:login animated:YES];
    }

}


- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.hidden = YES;
}


- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    self.tabBarController.tabBar.hidden = NO;
}

@end
